<template>
  <div class="app-container">
    <div class="filter-container">
      <el-input
        v-model="listQuery.queryKey"
        placeholder="关键字"
        style="width: 200px;"
        class="filter-item"
        @keyup.enter.native="dataLoad"
      />
      <el-button
        class="filter-item"
        type="primary"
        icon="el-icon-search"
        @click="dataLoad"
      >搜索</el-button>
    </div>
    <el-table
      v-loading="isLoading"
      :data="tableData"
      border
      fit
      highlight-current-row
      style="width: 100%"
    >
      <el-table-column align="center" label="用户编号" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.id }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="真实姓名" width="150">
        <template slot-scope="scope">
          <span>{{ scope.row.realName }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="手机号" width="220">
        <template slot-scope="scope">
          <span>{{ scope.row.mobile }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="邮箱" width="220">
        <template slot-scope="scope">
          <span>{{ scope.row.bankName }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="学生证号" width="300">
        <template slot-scope="scope">
          <span>{{ scope.row.cardNumber }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="身份证号" width="150">
        <template slot-scope="scope">
          <span>{{ scope.row.totalFee }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="用户状态">
        <template slot-scope="scope">
          <span>{{ scope.row.totalFee }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="详情" width="120">
        <template slot-scope="{row}">
          <router-link :to="'/wallet/detail/'+row.id" class="link-type">
            <span>详情</span>
          </router-link>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="tableDataTotal>0"
      :total="tableDataTotal"
      :page.sync="listQuery.pageIndex"
      :limit.sync="listQuery.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { getUnverifiedUserList } from "@/api/menu-user";
import Pagination from "@/components/Pagination"; // Secondary package based on el-pagination

export default {
  components: { Pagination },
  data() {
    return {
      tableData: null,
      tableDataTotal: 0,
      isLoading: true,
      listQuery: {
        queryKey: "",
        pageIndex: 1,
        pageSize: 20
      }
    };
  },
  methods: {
    dataLoad() {
      this.listQuery.page = 1
      this.getList()
    },
    getList() {
      this.isLoading = true;
      getUnverifiedUserList(this.listQuery).then(response => {
        this.tableData = response.data.data;
        this.tableDataTotal = response.data.total;
        this.isLoading = false;
      });
    }
  },  
  created() {
    this.getList();
  }
};
</script>

<style scoped>
.edit-input {
  padding-right: 100px;
}
.cancel-btn {
  position: absolute;
  right: 15px;
  top: 10px;
}
</style>
